package org.mushroomdb.transaction;

public class Operation {

    private String methodName;

    private Object[] parameters;

    public Operation(String methodName, Object[] parameters) {
        this.methodName = methodName;
        this.parameters = parameters;

    }

    public Class[] getClasses() {
        if (this.parameters == null) {
            return null;
        }
        if ("setValue".equals(this.methodName)) {
            Class[] classes = {int.class,Object.class};
            return classes;
        } else {
            int size = this.parameters.length;
            Class[] classes = new Class[size];
            for (int i = 0; i < size; i++) {
                classes[i] = this.parameters[i].getClass();
            }
            return classes;
        }

    }

    public Object[] getArgs() {
        return this.parameters;
    }

    public String getMethodName() {
        return this.methodName;
    }

}
